package com.beauty.order.service;

import com.beauty.order.dto.OrderRequest;
import com.beauty.order.dto.OrderResponse;
import com.beauty.order.dto.PageResponse;
import com.beauty.order.entity.Order;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.data.domain.Pageable;

import java.time.LocalDateTime;
import java.util.List;

public interface OrderService {

    OrderResponse createOrder(OrderRequest orderRequest) throws JsonProcessingException;

    OrderResponse getOrderById(Long id);

    OrderResponse getOrderByOrderNumber(String orderNumber);

    List<OrderResponse> getOrdersByCustomerId(String customerId);
    /**
     * 通过订单号更新订单状态
     * @param orderNumber 订单号
     * @param status 状态
     * @return 更新后的订单
     */
    Order updateOrderStatusByOrderNumber(String orderNumber, String status);
    List<OrderResponse> getOrdersByStatus(Order.OrderStatus status);

    List<OrderResponse> getOrdersByDateRange(LocalDateTime start, LocalDateTime end);

    List<OrderResponse> getAllOrders();

    OrderResponse updateOrderStatus(Long id, Order.OrderStatus status);

    OrderResponse updateTrackingNumber(Long id, String trackingNumber);

    void deleteOrder(Long id);

    PageResponse<OrderResponse> getOrdersPage(Pageable pageable);

    PageResponse<OrderResponse> getOrdersByCustomerIdPage(String customerId, Pageable pageable);

    PageResponse<OrderResponse> getOrdersByStatusPage(Order.OrderStatus status, Pageable pageable);

    PageResponse<OrderResponse> getOrdersByDateRangePage(LocalDateTime start, LocalDateTime end, Pageable pageable);

    PageResponse<OrderResponse> searchOrders(String keyword, Pageable pageable);

    PageResponse<OrderResponse> advancedSearch(String orderNumber, String customerId,
                                             String trackingNumber, String notes,
                                             String shippingAddress, Pageable pageable);

    /**
     * 通过ID获取订单实体
     */
    Order getOrderByIdEntity(Long id);
}
